Part Number Hot Search : 
ICS91 MX7547CQ SMBJ43 CX3CSM1 KP4010 A1281Y 001444 M4004
Product Description
Full Text Search
 

To Download AN1305 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 MOTOROLA
SEMICONDUCTOR APPLICATION NOTE
Order this document by AN1305/D
An Evaluation System for Direct Interface of the MPX5100 Pressure Sensor with a Microprocessor
Prepared by: Bill Lucas Discrete Applications Engineering
AN1305
INTRODUCTION
Interfacing pressure sensors to analog-to-digital converters or microprocessors with on-chip A/D converters has been a challenge that most engineers do not enjoy accepting. Recent design advances in pressure sensing technology have allowed the engineer to directly interface a pressure sensor to an A/D converter with no additional active components. This has been made possible by integrating a temperature compensated pressure sensor element and active linear circuitry on the same die. A description of an evaluation board that shows the ease of interfacing a signal conditioned pressure sensor to an A/D converter is presented here.
Figure 1. DEVB-114 MPX5100 Evaluation Module
REV 1
Motorola Sensor Device Data (c) Motorola, Inc. 1997
1
AN1305
PURPOSE
This evaluation system, shown in Figure 1, demonstrates the ease of operation and interfacing of the Motorola MPX5100 series pressure sensors with on-chip temperature compensation, calibration and amplification. The board may be used to evaluate the sensor's suitability for a specific application. offset. The sensor's zero offset voltage with no pressure applied to the sensor is empirically computed each time power is applied to the system and stored in RAM. The sensitivity of the MPX5100 is repeatable from unit to unit. There is a facility for a small "rubbering" of the slope constant built into the program. It is accomplished with jumpers J1 and J2, and is explained in the Operation section. The board contents are further described in the schematic, silk screen plot, and parts list that appear in Figures 2, 3 and Table 1.
DESCRIPTION
The DEVB-114 evaluation board is constructed on a small printed circuit board. It is powered from a single +5 Vdc regulated power supply. The system will display the pressure applied to the MPX5100 sensor in pounds per square inch. The range is 0 PSI through 15 PSI, resolved to 0.1 PSI. No potentiometers are used in the system to adjust the span and
BASIC CIRCUIT
The evaluation board consists of three basic subsystems: an MPX5100GP pressure sensor, a four digit liquid crystal display (only three digits and a decimal are used) and a programmed microprocessor with the necessary external circuitry to support the operation of the microprocessor.
LCD LIQUID CRYSTAL DISPLAY IEE PART NUMBER LCD5657 OR EQUAL
BP
28 37 36 5
6
7 34 35
8
31 32 9
10
11 29 30
12
26 27 13 14
15 24 25
16
22 23 17
18 19 20 21
1-4, 33 39, 38, 40
49 0
47 48 42 43 44 45 46 217 6 543 PORTC
37 38 32 33 34 35 36 217 6 54 3 PORTB
31 0
29 30 24 25 26 27 28 2 17 6 54 3 PORTA R5
+5 15 OHM 1% 4.85 V R6 VRL 7 453 OHM 1% .302 V 30.1 OHM 1%
52
U1 TD0
VRH
8
MC68HC705B5FN
50 44 RDI VSS ___ IRQ 19 ______ RESET 18 PD4 PD3 PD1 VPP6 VDD PD2 PD0 9 10 11 12 13 14 15 +5
OSC1 16 4 MHz Y1
OSC2 17
PD5 5
PD6 PD7 4 3 10K 10K
R3
4.7K R1
TCAP1 D/A TCAP2 21 22 23
R7
RESET R4 U2 IN 34064P- 5
+5
22 pF C3
R2 10MEG
22 pF C4
J1
J2 +5
+5 J3 GND
+ C1 100 F
.1 C2
+5 OUT
VCC XDCR1 MPX5100 GND
Figure 2. DEVB-114 System Schematic
2
Motorola Sensor Device Data
AN1305
Table 1. DEVB-114 Parts List
Designators C1 C2 C3, C4 J1, J2 LCD R1 R2 R3, R4 R5 R6 R7 XDCR1 U1 U2 Y1 No Designator No Designator No Designator Quant. 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 Description 100 F Electrolytic Capacitor 0.1 F Ceramic Capacitor 22 pF Ceramic Capacitor Dual Row Straight .025 Pins Arranged On .1 Grid Liquid Crystal Display 4.7 k Ohm Resistor 10 Meg Ohm Resistor 10 k Ohm Resistor 15 Ohm 1% 1/4 W Resistor 453 Ohm 1% 1/4 W Resistor 30.1 Ohm 1% 1/4 W Resistor Pressure Sensor Microprocessor Under Voltage Detector Crystal (Low Profile) 52 Pin PLCC Socket Jumpers For J1 and J2 Bare Printed Circuit Board 4.0 MHz Motorola Motorola Motorola Motorola ECS AMP Molex MPX5100GP MC68HC705B5FN or XC68HC705B5FN MC34064P-5 ECS-40-S-4 821-575-1 15-29-1025 Rating 25 Vdc 50 Vdc 100 Vdc Manufacturer Sprague Sprague Mepco/Centralab Molex AMPEREX Part Number 513D107M025BB4 1C105Z5U104M050B CN15A220K 10-89-1043 LTD226R-12
Note: All resistors are 1/4 W resistors with a tolerance of 5% unless otherwise noted. Note: All capacitors are 100 volt, ceramic capacitors with a tolerance of 10% unless otherwise noted.
LCD1
U1
J1 J2 R3 R4 R5 R6 R7 GND J3 +5
R1
C2 C3 C1 Y1
C4
U2
VCC R2 XDRC OUT 1 GND
TP1 TP2 TP3
XDRC1
DEVB-114 REV. 0
Figure 3. Silk Screen Motorola Sensor Device Data 3
AN1305
Theory of Operation Referring to the schematic, Figure 2, the MPX5100 pressure sensor is connected to PORT D bit 5 of the microprocessor. This port is an input to the on-chip 8 bit analog to digital converter. The pressure sensor provides a signal output to the microprocessor of approximately 0.5 Vdc at 0 psi to 4.5 Vdc at 15 psi of applied pressure as shown in Figure 4. The input range of the A to D converter is set at approximately 0.3 Vdc to 4.85 Vdc. This compresses the range of the A to D converter around the output range of the sensor to maximize the A to D converter resolution; 0 to 255 counts is the range of the A to D converter. VRH and VRL are the reference voltage inputs to the A to D converter. The resolution is defined by the following: Analog-to-digital converter count = [(Vxdcr - VRL)/(VRH - VRL)] * 255 The count at 0 psi = [(.5 - .302)/(4.85 - .302)] * 255 11 The count at 15 psi = [(4.5 - .302)/(4.85 - .302)] * 255 235 Therefore the resolution = count @ 15 psi - count @ 0 psi or the resolution is (235 - 11) = 224 counts. This translates to a system that will resolve to 0.1 psi. The microprocessor section of the system requires certain support hardware to allow it to function. The MC34064P-5 (U2) provides an under voltage sense function which is used to reset the microprocessor at system power-up. The 4 MHz crystal (Y1) provides the external portion of the oscillator function for clocking the microprocessor and provides a stable base for time based functions. Jumpers J1 and J2 are examined by the software and are used to "rubber" the slope constant.
OPERATION
The system must be connected to a 5 Vdc regulated power supply. Note the polarity marked on the power terminal J3. Jumpers J1 and J2 must either both be installed or both be removed for the normal slope constant to be used. The pressure port on the MPX5100 sensor must be left open to atmosphere anytime the board is powered-up. As previously stated, the sensor's voltage offset with zero pressure applied is computed at power-up. You will need to apply power to the system. The LCD will display CAL for approximately 5 seconds. After that time, the LCD will then start displaying pressure. To improve upon the accuracy of the system, you can change the constant used by the program that constitutes the span of the sensor. You will need an accurate test gauge to measure the pressure applied to the sensor. Anytime after the display has completed the zero calculation (after CAL is no longer displayed), apply 15.0 PSI to the sensor. Make sure that jumpers J1 and J2 are either both installed or both removed. Referring to Table 2, you can increase the displayed value by installing J1 and removing J2. Conversely, you can decrease the displayed value by installing J2 and removing J1.
J1 IN OUT OUT J2 IN OUT IN OUT Action USE NORMAL SPAN CONSTANT USE NORMAL SPAN CONSTANT DECREASE SPAN CONSTANT APPROXIMATELY 1.5% INCREASE SPAN CONSTANT APPROXIMATELY 1.5%
4.5
VS = 5.0 Vdc TA = 25C MPX5100
TYP
OUTPUT (Vdc)
MIN MAX
TYP SPAN
0.5 TYP OFFSET 0 0 kPa PSI 25 3.62 50 7.25 75 10.87 100 14.5 IN
Table 2.
Figure 4. MPX5100 Output versus Pressure Input
SOFTWARE
The voltage divider consisting of R5 through R7 is connected to the +5 volts powering the system. The output of the pressure sensor is ratiometric to the voltage applied to it. The pressure sensor and the voltage divider are connected to a common supply; this yields a system that is ratiometric. By nature of this ratiometric system, variations in the voltage of the power supplied to the system will have no effect on the system accuracy. The liquid crystal display is directly driven from I/O ports A, B, and C on the microprocessor. The operation of a liquid crystal display requires that the data and backplane pins must be driven by an alternating signal. This function is provided by a software routine that toggles the data and backplane at approximately a 30 Hz rate. The source code, compiler listing, and S-record output for the software used in this system are available on the Motorola Freeware Bulletin Board Service in the MCU directory under the filename DEVB-114.ARC. To access the bulletin board you must have a telephone line, a 300, 1200 or 2400 baud modem and a terminal or personal computer. The modem must be compatible with the Bell 212A standard. Call 1-512-891-3733 to access the Bulletin Board Service. The software for the system consists of several modules. Their functions provide the capability for system calibration as well as displaying the pressure input to the MPX5100 transducer. Figure 5 is a flowchart for the program that controls the system.
4
Motorola Sensor Device Data
AN1305
START INITIALIZE DISPLAY I/O PORTS INITIALIZE TIMER REGISTERS ALLOW INTERRUPTS PERFORM AUTO ZERO SLOPE = 64 TIMER INTERRUPT YES J1 OUT? SERVICE TIMER REGISTERS SETUP COUNTER FOR NEXT INTERRUPT SERVICE LIQUID CRYSTAL DISPLAY RETURN FROM INTERRUPT NO J2 OUT? NO YES SLOPE = 65 SLOPE = 63
ACCUMULATE 100 A/D CONVERSIONS COMPUTE INPUT PRESSURE CONVERT TO DECIMAL PLACE IN RESULT OUTPUT BUFFER
Figure 5. DEVB-114 Software Flowchart
The compiler used in this project was provided by BYTE CRAFT LTD. (519) 888-6911. A compiler listing of the program is included at the end of this document. The following is a brief explanation of the routines: delay() Used to provide approximately a 20 ms loop. read_a2d() Performs one hundred reads on the analog to digital converter on multiplexer channel 5 and returns the accumulation. fixcompare() Services the internal timer for 30 ms timer compare interrupts. TIMERCMP() Alternates the data and backplane for the liquid crystal display. initio() Sets up the microcomputer's I/O ports, timer, allows processor interrupts, and calls adzero(). adzero() This routine is necessary at power-up time because it delays the power supply and allows the
transducer to stabilize. It then calls `read_atod()' and saves the returned value as the sensors output voltage with zero pressure applied. cvt_bin_dec(unsigned long arg) This routine converts the unsigned binary argument passed in `arg' to a five digit decimal number in an array called `digit'. It then uses the decimal results for each digit as an index into a table that converts the decimal number into a segment pattern for the display. It is then output to the display. display_psi() This routine is called from `main()'. The analog to digital converter routine is called, the pressure is calculated, and the pressure applied to the sensor is displayed. The loop then repeats. main() This is the main routine called from reset. It calls `initio()' to set up the system's I/O. `display_psi()' is called to compute and display the pressure applied to the sensor.
Motorola Sensor Device Data
5
AN1305
SOFTWARE SOURCE/ASSEMBLY PROGRAM CODE
#pragma option v ; /* rev 1.1 code rewritten to use the MC68HC705B5 instead of the MC68HC805B6. WLL 6/17/91 THE FOLLOWING 'C' SOURCE CODE IS WRITTEN FOR THE DEVB-114 DEMONSTRATION BOARD. IT WAS COMPILED WITH A COMPILER COURTESY OF: BYTE CRAFT LTD. 421 KING ST. WATERLOO, ONTARIO CANADA N2J 4E4 (519)888-6911 SOME SOURCE CODE CHANGES MAY BE NECESSARY FOR COMPILATION WITH OTHER COMPILERS. BILL LUCAS 8/5/90 MOTOROLA, SPS */ 0800 1700 0050 0096 #pragma memory ROMPROG [5888] #pragma memory RAMPAGE0 [150] /* #pragma #pragma #pragma #pragma #pragma #pragma #pragma @ 0x0800 ; @ 0x0050 ;
1FFE 1FFC 1FFA 1FF8 1FF6 1FF4 1FF2
Vector assignments */ vector __RESET @ 0x1ffe vector __SWI @ 0x1ffc vector IRQ @ 0x1ffa vector TIMERCAP @ 0x1ff8 vector TIMERCMP @ 0x1ff6 vector TIMEROV @ 0x1ff4 vector SCI @ 0x1ff2
; ; ; ; ; ; ;
#pragma has STOP ; #pragma has WAIT ; #pragma has MUL ; /* #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma Register assignments for the 68HC705B5 microcontroller */ portrw porta @ 0x00; /* portrw portb @ 0x01; /* portrw portc @ 0x02; /* portrw portd @ 0x03; /* in ,- ,SS ,SCK ,MOSI,MISO,TxD,RxD portrw ddra @ 0x04; /* Data direction, Port A portrw ddrb @ 0x05; /* Data direction, Port B portrw ddrc @ 0x06; /* Data direction, Port C (all output) portrw eeclk @ 0x07; /* eeprom/eclk cntl */ portrw addata @ 0x08; /* a/d data register */ portrw adstat @ 0x09; /* a/d stat/control */ portrw plma @ 0x0a; /* pulse length modulation a */ portrw plmb @ 0x0b; /* pulse length modulation b */ portrw misc @ 0x0c; /* miscellaneous register */ portrw scibaud @ 0x0d; /* sci baud rate register */ portrw scicntl1 @ 0x0e; /* sci control 1 */ portrw scicntl2 @ 0x0f; /* sci control 2 */ portrw scistat @ 0x10; /* sci status reg */
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010
*/ */ */ */ */ */ */
6
Motorola Sensor Device Data
AN1305
0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma #pragma portrw portrw portrw portrw portrw portrw portrw portrw portrw portrw portrw portrw portrw portrw portrw scidata tcr tsr icaphi1 icaplo1 ocmphi1 ocmplo1 tcnthi tcntlo acnthi acntlo icaphi2 icaplo2 ocmphi2 ocmplo2 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 0x11; 0x12; 0x13; 0x14; 0x15; 0x16; 0x17; 0x18; 0x19; 0x1A; 0x1B; 0x1c; 0x1d; 0x1e; 0x1f; /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* SCI Data */ ICIE,OCIE,TOIE,0;0,0,IEGE,OLVL */ ICF,OCF,TOF,0; 0,0,0,0 */ Input Capture Reg (Hi-0x14, Lo-0x15) */ Input Capture Reg (Hi-0x14, Lo-0x15) */ Output Compare Reg (Hi-0x16, Lo-0x17)*/ Output Compare Reg (Hi-0x16, Lo-0x17)*/ Timer Count Reg (Hi-0x18, Lo-0x19) */ Timer Count Reg (Hi-0x18, Lo-0x19) */ Alternate Count Reg (Hi-$1A, Lo-$1B) */ Alternate Count Reg (Hi-$1A, Lo-$1B) */ Input Capture Reg (Hi-0x1c, Lo-0x1d) */ Input Capture Reg (Hi-0x1c, Lo-0x1d) */ Output Compare Reg (Hi-0x1e, Lo-0x1f)*/ Output Compare Reg (Hi-0x1e, Lo-0x1f)*/
/* put constants and variables here...they must be global */ /***********************************************************************/ #pragma mor @ 0x1EFE = 0x74; /* this disables the watchdog counter and does not add pull-down resistors on ports B and C */ const char lcdtab[]={0xfc,0x30,0xda,0x7a,0x36,0x6e,0xe6,0x38,0xfe,0x3e }; /* lcd pattern table 0 1 2 3 4 5 const long dectable[] = { 10000, 1000, 100, 10 }; 6 7 8 9 */
1EFE 74
0800 FC 30 DA 7A 36 6E E6 38 FE 0809 3E 080A 27 10 03 E8 00 64 00 0A 0050 0005 0000 0055
unsigned int digit[5]; /* buffer to hold results from cvt_bin_dec functio */ registera ac; long atodtemp; /* processor's A register */ /* temp to accumulate 100 a/d readings for smoothing */
0059 005B 005C 005E 0060 0062
long slope; int adcnt; long xdcr_offset;
/* multiplier for adc to engineering units conversion */ /* a/d converter loop counter */ /* initial xdcr offset */
unsigned long i,j; /* counter for loops */ int k; struct bothbytes { int hi; int lo; }; union isboth { long l; struct bothbytes b; }; /* misc variable */
0063 0002
union isboth q;
/* used for timer set-up */
Motorola Sensor Device Data
7
AN1305
/**************************************************************************/ /* code starts here */ /**************************************************************************/ /* these interrupts are not used...give them a graceful return if for some reason one occurs */ 1FFC 0812 1FFA 0813 1FF8 0814 1FF4 0815 1FF2 0816 08 80 08 80 08 80 08 80 08 80 12 RTI 13 RTI 14 RTI 15 RTI 16 RTI /**************************************************************************/ void delay(void) /* just hang around for a while */ { for (i=0; i<20000; ++i); $57 $58 $57 $5E $58 $5F $5F #$20 $5E #$4E $0836 $5F $0834 $5E $0824 } /**************************************************************************/ read_a2d(void) { /* read the a/d converter on channel 5 and accumulate the result in atodtemp */ 0837 0839 083B 083C 083E 0840 0842 0844 3F 3F 4F B7 B6 A8 A1 24 56 55 5B 5B 80 E4 21 CLR CLR CLRA STA LDA EOR CMP BCC $56 $55 $5B $5B #$80 #$E4 $0867 atodtemp=0; /* zero for accumulation */ SCI(){} TIMEROV(){} TIMERCAP(){} IRQ(){} __SWI(){}
0817 0818 081A 081C 081E 0820 0822 0824 0826 0828 082A 082C 082E 0830 0832 0834 0836
4F 3F B7 B6 B7 B6 B7 B6 A0 B6 A2 24 3C 26 3C 20 81
57 58 57 5E 58 5F 5F 20 5E 4E 08 5F 02 5E EE
CLRA CLR STA LDA STA LDA STA LDA SUB LDA SBC BCC INC BNE INC BRA RTS
for ( adcnt = 0 ; adcnt<100; ++adcnt) /* do 100 a/d conversions */
8
Motorola Sensor Device Data
AN1305
{ 0846 0848 084A 084D 084F 0851 0853 0855 0857 0859 085B 085D 085F 0861 0863 0865 0867 0869 086B 086D 086F 0871 0873 0875 0878 087B 087D 087F A6 B7 0F B6 3F B7 BB B7 B6 B9 B7 B7 B6 B7 3C 20 B6 B7 B6 B7 3F A6 B7 CD CD BF B7 81 25 09 09 FD 08 57 58 56 58 57 55 57 55 58 56 5B D7 56 58 55 57 66 64 67 0A 5E 0A 8F 55 56 LDA #$25 STA $09 BRCLR 7,$09,$084A LDA $08 CLR $57 STA $58 ADD $56 STA $58 LDA $57 ADC $55 STA $57 STA $55 LDA $58 STA $56 } INC BRA LDA STA LDA STA CLR LDA STA JSR JSR STX STA RTS $5B $083E $56 $58 $55 $57 $66 #$64 $67 $0A5E $0A8F $55 $56 } /**************************************************************************/ void fixcompare (void) /* sets-up the timer compare for the next interrup */ { q.b.hi =tcnthi; q.b.lo = tcntlo; q.l +=7500; /* ((4mhz xtal/2)/4) = counter period = 2us.*7500 = 15ms.*/ adstat = 0x25; /* convert on channel 5 */ while (!(adstat & 0x80)); /* wait for a/d to complete */ atodtemp = addata + atodtemp;
atodtemp = atodtemp/100;
return atodtemp;
0880 0882 0884 0886 0888 088A 088C 088E 0890 0892 0894 0896 0898 089A
B6 B7 B6 B7 AB B7 B6 A9 B7 B7 B6 B6 B7 81
18 63 19 64 4C 64 63 1D 63 16 13 64 17
LDA STA LDA STA ADD STA LDA ADC STA STA LDA LDA STA RTS
$18 $63 $19 $64 #$4C $64 $63 #$1D $63 $16 $13 $64 $17
ocmphi1 = q.b.hi; ac=tsr; ocmplo1 = q.b.lo; }
1FF6 08 9B
/*************************************************************************/ void TIMERCMP (void) /* timer service module */ {
Motorola Sensor Device Data
9
AN1305
089B 089D 089F 08A1 08A3 33 33 33 AD 80 02 01 00 DD COM COM COM BSR RTI $02 $01 $00 $0880 } /************************************************************************/ void adzero(void) { 08A4 08A5 08A7 08A9 08AB 08AD 08AF 08B1 08B3 08B5 08B7 08B9 4F 3F B7 B6 B7 B6 B7 B6 A0 B6 A2 24 CLRA CLR STA LDA STA LDA STA LDA SUB LDA SBC BCC for ( j=0; j<20; ++j) $57 $58 $57 $60 $58 $61 $61 #$14 $60 #$00 $08C6 power supply time to settle down */ { 08BB CD 08 17 08BE 08C0 08C2 08C4 08C6 08C9 08CB 08CD 3C 26 3C 20 CD 3F B7 81 61 02 60 EB 08 37 5C 5D JSR INC BNE INC BRA JSR CLR STA RTS $0817 } $61 $08C4 $60 $08B1 $0837 $5C $5D } /**************************************************************************/ void initio (void) /* setup the I/O */ { adstat = 0x20; /* power-up the A/D */ porta = portb = portc = 0; delay(); /* give the sensor time to "warm-up" and the /* called by initio() to save initial xdcr's zero pressure offset voltage output */ portc =~ portc; portb =~ portb; porta =~ porta; fixcompare(); /* service the lcd */
57 58 57 60 58 61 61 14 60 00 0B
xdcr_offset =
read_a2d();
08CE 08D0 08D2 08D4 08D6 08D8 08DA 08DC 08DE 08E0 08E2 08E4 08E6 08E8
A6 B7 3F 3F 3F A6 B7 B7 B7 B6 3F 3F B6 AD
20 09 02 01 00 FF 06 05 04 13 1E 16 1F 96
LDA STA CLR CLR CLR LDA STA STA STA LDA CLR CLR LDA BSR
#$20 $09 $02 $01 $00 #$FF $06 $05 $04 $13 $1E $16 $1F $0880
ddra = ddrb = ddrc = 0xff;
ac=tsr; /* dummy read */ ocmphi1 = ocmphi2 = 0; ac = ocmplo2; /* clear out output compare 2 if it happens to be set */ fixcompare(); /* set-up for the first timer interrupt */
10
Motorola Sensor Device Data
AN1305
08EA A6 40 08EC B7 12 08EE 9A 08EF 08F1 08F3 08F5 08F7 08F9 08FB 08FD A6 B7 A6 B7 A6 B7 AD 81 CC 02 BE 01 C4 00 A7 LDA STA CLI LDA STA LDA STA LDA STA BSR RTS #$40 $12 tcr = 0x40; CLI; /* let the interrupts begin ! /* write CAL to the display */ portc = 0xcc; /* C */ portb = 0xbe; /* A */ porta = 0xc4; /* L */ adzero(); } /**************************************************************************/ void cvt_bin_dec(unsigned long arg) /* First converts the argument to a five digit decimal value. The msd is in the lowest address. Then leading zero suppresses the value and writes it to the display ports. The argument value range is 0..65535 decimal. */ 0069 08FE 0900 006B 006C 0902 0903 0905 0907 0909 { BF 69 B7 6A STX STA $69 $6A char i; unsigned long l; for ( i=0; i < 5; ++i ) $6B $6B #$05 $0912 { 090B 97 090C 6F 50 090E 0910 0912 0913 0915 0917 0919 091B 091C 091D 0920 0922 0924 0927 0929 3C 20 4F B7 B6 A1 24 97 58 D6 B1 26 D6 B1 27 6B F3 6B 6B 04 70 TAX CLR INC BRA CLRA STA LDA CMP BCC TAX LSLX LDA CMP BNE LDA CMP BEQ LDX LSLX LDA digit[i] = 0x0; $50,X } $6B $0905 for ( i=0; i < 4; ++i ) $6B $6B #$04 $098B { if ( arg $080B,X $6A $092B $080A,X $69 $0987 { 092B BE 6B 092D 58 092E D6 08 0A $6B $080A,X l = dectable[i]; >= dectable [i] ) /* put blanks in all digit positions */ */
#$CC $02 #$BE $01 #$C4 $00 $08A4
4F B7 B6 A1 24
6B 6B 05 07
CLRA STA LDA CMP BCC
08 0B 6A 07 08 0A 69 5C
Motorola Sensor Device Data
11
AN1305
0931 0933 0936 0938 093A 093C 093E 0940 0942 0944 0946 0948 094B 094E 0950 0952 0954 0956 0958 095A 095C 095E 0960 0962 0964 0966 0969 096B 096D 096F 0971 0973 0975 0977 0979 097B 097D 097F 0981 0983 0985 B7 D6 B7 B6 B7 B6 B7 B6 B7 B6 B7 CD CD BF B7 BE E7 BE E6 3F B7 B6 B7 B6 B7 CD BF B7 33 30 26 3C B6 BB B7 B6 B9 B7 B7 B6 B7 6C 08 6D 6A 58 69 57 6C 66 6D 67 0A 0A 57 58 6B 50 6B 50 57 58 6C 66 6D 67 0A 57 58 57 58 02 57 58 6A 58 57 69 57 69 58 6A 0B STA LDA STA LDA STA LDA STA LDA STA LDA STA JSR JSR STX STA LDX STA LDX LDA CLR STA LDA STA LDA STA JSR STX STA COM NEG BNE INC LDA ADD STA LDA ADC STA STA LDA STA $6C $080B,X $6D $6A $58 $69 $57 $6C $66 $6D $67 $0A5E $0A8F $57 $58 $6B $50,X $6B $50,X $57 $58 $6C $66 $6D $67 $0A3F $57 $58 $57 $58 $0975 $57 $58 $6A $58 $57 $69 $57 $69 $58 $6A } } 0987 0989 098B 098D 098F 0991 0993 0995 0997 3C 20 B6 B7 B6 B7 BE B6 E7 6B 8A 6A 58 69 57 6B 58 50 INC BRA LDA STA LDA STA LDX LDA STA $6B $0915 $6A $58 $69 $57 $6B $58 $50,X digit[i] = arg / l;
5E 8F
arg = arg-(digit[i] * l);
3F
digit[i] = arg;
0999 9B
SEI
/* now zero suppress and send the lcd pattern to the display */ SEI;
12
Motorola Sensor Device Data
AN1305
099A 099C 099E 09A0 09A2 09A4 09A7 09A9 09AB 09AD 09AF 09B1 09B3 09B5 09B7 09BA 09BC 09BE 09C1 09C2 09C4 09C5 09C8 3D 26 3F 20 BE D6 B7 3D 26 3D 26 3F 20 BE D6 B7 BE D6 4C B7 9A CD 81 50 04 02 07 50 08 00 02 50 08 51 04 01 07 51 08 00 01 52 08 00 00 08 17 TST BNE CLR BRA LDX LDA STA TST BNE TST BNE CLR BRA LDX LDA STA LDX LDA INCA STA CLI JSR RTS $50 $09A2 $02 $09A9 $50 $0800,X $02 $50 $09B5 $51 $09B5 $01 $09BC $51 $0800,X $01 $52 $0800,X $00 CLI; $0817 } /****************************************************************/ void display_psi(void) /* At power-up it is assumed that the pressure port of the sensor is open to atmosphere. The code in initio() delays for the sensor and power to stabilize. One hundred A/D conversions are averaged and divided by 100. The result is called xdcr_offset. This routine calls the A/D routine which performs one hundred conversions, divides the result by 100 and returns the value. If the value returned is less than or equal to the xdcr_offset, the value of xdcr_offset is substituted. If the value returned is greater than xdcr_offset, xdcr_offset is subtracted from the returned value. That result is multiplied by a constant to yield pressure in PSI * 10 to yield a "decimal point". */ { while(1) { slope = 64; delay(); if ( digit[0] == 0 ) /* leading zero suppression */ portc = 0; else portc = ( lcdtab[digit[0]] );
/* 100's digit */
if ( digit[0] == 0 && digit[1] == 0 )
portb=0; else portb = ( lcdtab[digit[1]] );
/* 10's digit */
porta = ( lcdtab[digit[2]]+1 ); /* 1's digit + decimal point */
09C9 09CB 09CD 09CF 09D1 09D3 09D5 09D7 09D9 09DB 09DD 09DF
3F A6 B7 B6 A4 B7 A1 26 3F A6 B7 B6
59 40 5A 03 C0 62 80 06 59 41 5A 62
CLR LDA STA LDA AND STA CMP BNE CLR LDA STA LDA
$59 #$40 $5A $03 #$C0 $62 #$80 $09DF $59 #$41 $5A $62
k = portd & 0xc0;
/* this lets us "rubber" the slope to closer fit
if ( k == 0x80 ) slope = 65;
the slope of the sensor */ /* J2 removed, J1 installed */
if ( k == 0x40 ) /* J1 removed, J2 installed */
Motorola Sensor Device Data
13
AN1305
09E1 09E3 09E5 09E7 09E9 09EB 09EE 09F0 09F2 09F4 09F6 09F8 09FA 09FC 09FE 0A00 0A02 0A04 0A06 0A08 0A0A 0A0C 0A0E 0A10 0A12 0A14 0A16 0A18 0A1A 0A1C 0A1E 0A20 0A22 0A24 0A26 0A28 0A2A 0A2D 0A2F 0A31 0A34 0A36 A1 26 3F A6 B7 CD 3F B7 B0 B7 B6 A8 B7 B6 A8 B2 BA 22 B6 B7 B6 B7 B6 B0 B7 B6 B2 B7 B6 B7 B6 B7 B6 B7 B6 B7 CD BF B7 CD 20 81 40 06 59 3F 5A 08 37 55 56 5D 58 5C 80 57 55 80 57 58 08 5C 55 5D 56 56 5D 56 55 5C 55 56 58 55 57 59 66 5A 67 0A 3F 55 56 08 FE 93 CMP BNE CLR LDA STA JSR CLR STA SUB STA LDA EOR STA LDA EOR SBC ORA BHI LDA STA LDA STA LDA SUB STA LDA SBC STA LDA STA LDA STA LDA STA LDA STA JSR STX STA JSR BRA RTS #$40 $09EB $59 #$3F $5A $0837 $55 $56 $5D $58 $5C #$80 $57 $55 #$80 $57 $58 $0A0E $5C $55 $5D $56 $56 $5D $56 $55 $5C $55 $56 $58 $55 $57 $59 $66 $5A $67 $0A3F $55 $56 $08FE $09C9 } /************************************************************************/ main() { initio(); /* set-up the processor's i/o */ display_psi(); while(1); /* should never get here */ } slope = 63;
/* else both jumpers are removed or installed... don't change the slope */ atodtemp = read_a2d(); /* atodtemp = raw a/d ( 0..255 ) */
if ( atodtemp <= xdcr_offset )
atodtemp = xdcr_offset;
atodtemp -=
xdcr_offset; /* remove the offset */
atodtemp *= slope; /* convert to psi */
cvt_bin_dec( atodtemp ); /* convert to decimal and display */ }
0A37 0A3A 0A3C 0A3E
CD 08 CE AD 8D 20 FE 81
JSR BSR BRA RTS LDX LDA
$08CE $09C9 $0A3C
0A3F BE 58 0A41 B6 67
$58 $67
14
Motorola Sensor Device Data
AN1305
0A43 0A44 0A46 0A48 0A4A 0A4C 0A4D 0A4F 0A51 0A53 0A55 0A56 0A58 0A5A 0A5B 0A5D 0A5E 0A60 0A61 0A63 0A65 0A66 0A68 0A6A 0A6C 0A6E 0A70 0A72 0A74 0A76 0A78 0A7A 0A7C 0A7E 0A80 0A82 0A84 0A86 0A88 0A89 0A8A 0A8C 0A8E 0A8F 0A90 0A91 0A93 0A94 1FFE 42 B7 BF BE B6 42 BB B7 BE B6 42 BB B7 97 B6 81 3F 5F 3F 3F 5C 38 39 39 39 B6 B0 B7 B6 B2 B7 24 B6 BB B7 B6 B9 B7 99 59 39 24 81 53 9F BE 53 81 0A 70 71 57 67 71 71 58 66 71 71 70 MUL STA STX LDX LDA MUL ADD STA LDX LDA MUL ADD STA TAX LDA RTS CLR CLRX CLR CLR INCX LSL ROL ROL ROL LDA SUB STA LDA SBC STA BCC LDA ADD STA LDA ADC STA SEC ROLX ROL BCC RTS COMX TXA LDX COMX RTS $70 $71 $57 $67 $71 $71 $58 $66 $71 $71 $70
70 6E 6F 58 57 6E 6F 6E 67 6E 6F 66 6F 0D 67 6E 6E 66 6F 6F
$70 $6E $6F $58 $57 $6E $6F $6E $67 $6E $6F $66 $6F $0A89 $67 $6E $6E $66 $6F $6F
70 D8
$70 $0A66
70
$70
37
Motorola Sensor Device Data
15
AN1305
SYMBOL TABLE LABEL IRQ TIMEROV __MUL16x16 __STOP acnthi adstat b ddrb digit hi icaplo1 j lo ocmphi2 plmb portd scicntl1 slope tsr VALUE 0813 0815 0A3F 0000 001A 0009 0000 0005 0050 0000 0015 0060 0001 001E 000B 0003 000E 0059 0013 | | | | | | | | | | | | | | | | | | | LABEL SCI __LDIV __RDIV __SWI acntlo adzero bothbytes ddrc display_psi i icaplo2 k main ocmplo1 porta q scicntl2 tcnthi xdcr_offset VALUE 0816 0A5E 0A8F 0812 001B 08A4 0002 0006 09C9 005E 001D 0062 0A37 0017 0000 0063 000F 0018 005C | | | | | | | | | | | | | | | | | | | LABEL TIMERCAP __LongIX __RESET __WAIT adcnt arg cvt_bin_dec dectable eeclk icaphi1 initio l misc ocmplo2 portb read_a2d scidata tcntlo VALUE 0814 0066 1FFE 0000 005B 0069 08FE 080A 0007 0014 08CE 0000 000C 001F 0001 0837 0011 0019 | | | | | | | | | | | | | | | | | | LABEL TIMERCMP __MUL __STARTUP __longAC addata atodtemp ddra delay fixcompare icaphi2 isboth lcdtab ocmphi1 plma portc scibaud scistat tcr VALUE 089B 0000 0000 0057 0008 0055 0004 0817 0880 001C 0002 0800 0016 000A 0002 000D 0010 0012
MEMORY USAGE MAP ('X' = Used, '-' = Unused) 0100 0140 0180 01C0 0800 0840 0880 08C0 0900 0940 0980 09C0 0A00 0A40 0A80 0AC0 1F00 1F40 1F80 1FC0 : : : : : : : : : : : : : : : : : : : : ---------------- ---------------- ---------------- ---------------- XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXX----------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- --------------X- XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX ---------------- ---------------- ---------------- ---------------- ---------------- --XXXXXXXXXXXXXX
All other memory blocks unused. Errors : 0 Warnings : 0
Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. "Typical" parameters which may be provided in Motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including "Typicals" must be validated for each customer application by customer's technical experts. Motorola does not convey any license under its patent rights nor the rights of others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part. Motorola and are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer. Mfax is a trademark of Motorola, Inc. How to reach us: USA / EUROPE / Locations Not Listed: Motorola Literature Distribution; P.O. Box 5405, Denver, Colorado 80217. 303-675-2140 or 1-800-441-2447 JAPAN: Nippon Motorola Ltd.; Tatsumi-SPD-JLDC, 6F Seibu-Butsuryu-Center, 3-14-2 Tatsumi Koto-Ku, Tokyo 135, Japan. 81-3-3521-8315
MfaxTM: RMFAX0@email.sps.mot.com - TOUCHTONE 602-244-6609 ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; 8B Tai Ping Industrial Park, - US & Canada ONLY 1-800-774-1848 51 Ting Kok Road, Tai Po, N.T., Hong Kong. 852-26629298 INTERNET: http://motorola.com/sps
16
AN1305/D Motorola Sensor Device Data


▲Up To Search▲   

 
Price & Availability of AN1305

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X